package com.wasion.pwportable.protocol.analyzer;

import java.util.HashMap;
import java.util.Map;

import com.wasion.pwportable.protocol.Protocol;
import com.wasion.pwportable.protocol.analyzer.indicator.Address_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.AirFactoryParams_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Battery_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.CableFactoryParams_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Cable_Data_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Capactiy_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Channel_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Common_WR_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Current_Params_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Current_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Device_Fault_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.ElectricField_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.GroundFault_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Ground_ElectricField_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Ground_MaxTime_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Ground_Rise_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Ground_Sample_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Ground_Temp_Current_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Ground_mutition_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.IndicatorInfo_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.LastShortCurrent_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.LastShortInfo_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Last_Ground_Time_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Line_Fault_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Load_Current_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Magnetic_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.ModuleMode_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.NEIGHBOR_INFO_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.OverHeat_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.RelayInfo_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.ShortElectricField_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.ShortFaultStatus_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.ShortFault_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Short_OverFlow_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.SleepTime_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.StartBits_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Startup_Params_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Status_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.TempValve_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Trival_Current_Params_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.ZeroSequence_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.indicator.Zero_Current_Params_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.terminal.AreaCode_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.terminal.REG_STATUS_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.terminal.Terminal_Comm_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.terminal.Terminal_Reset_Analyzer;
import com.wasion.pwportable.protocol.analyzer.terminal.Terminal_Version_Analyzer;
import com.wasion.pwportable.protocol.analyzer.update.FileRequest_RD_Analyzer;
import com.wasion.pwportable.protocol.analyzer.update.PreUpdate_RD_Analyzer;

public class AnalyzerFactory {
	private static AnalyzerFactory analyzerFactory = null;

	private static Map<String, AnalyzerIF> analyzerMap = new HashMap<String, AnalyzerIF>();

	public static synchronized AnalyzerFactory getFactory() {
		if (analyzerFactory == null)
			analyzerFactory = new AnalyzerFactory();
		return analyzerFactory;
	}

	private AnalyzerFactory() {

		// 无线升级相关
		analyzerMap.put(Protocol.PREUPDATE_IDENTIFIER,
				new PreUpdate_RD_Analyzer());

		analyzerMap.put(Protocol.FILE_REQUEST_IDENTIFIER,
				new FileRequest_RD_Analyzer());

		analyzerMap.put(Protocol.CHANNEL_RD, new Channel_RD_Analyzer());
		analyzerMap.put(Protocol.CHANNEL_WR, new Common_WR_Analyzer());
		analyzerMap.put(Protocol.SLEEP_TIME_RD, new SleepTime_RD_Analyzer());
		analyzerMap.put(Protocol.SLEEP_TIME_WR, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.INDI_TIME_RD, new IndicatorInfo_Analyzer());
		analyzerMap.put(Protocol.INDI_TIME_WR, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.INDICATOR_REBOOT, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.ELECTRIC_FIELD_RD,
				new ElectricField_RD_Analyzer());
		analyzerMap.put(Protocol.ELECTRIC_FIELD_WR, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.DEV_ADDR_RD, new Address_RD_Analyzer());
		analyzerMap.put(Protocol.DEV_ADDR_WR, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.DEV_INFO_RD, new IndicatorInfo_Analyzer());

		// analyzerMap.put(Protocol.EPROM_RD, new IndicatorEPROM_RD_Analyzer());

		analyzerMap.put(Protocol.TEMP_VAVLE_RD, new TempValve_RD_Analyzer());
		analyzerMap.put(Protocol.TEMP_VAVLE_WR, new Common_WR_Analyzer());

		// analyzerMap.put(Protocol.STARTUP_CURRENT_RD,
		// new Startup_Current_RD_Analyzer());
		analyzerMap.put(Protocol.STARTUP_CURRENT_WR, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.GROUND_RISE_RD, new Ground_Rise_RD_Analyzer());
		analyzerMap.put(Protocol.GROUND_RISE_WR, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.GROUND_MAXTIME_RD,
				new Ground_MaxTime_RD_Analyzer());
		analyzerMap.put(Protocol.GROUND_MAXTIME_WR, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.RUNNING_PARAM_RD,
				new Short_OverFlow_RD_Analyzer());
		analyzerMap.put(Protocol.RUNNING_PARAM_WR, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.ZERO_SEQUENCE_RD,
				new ZeroSequence_RD_Analyzer());
		analyzerMap.put(Protocol.ZERO_SEQUENCE_WR, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.STATUS_RD, new Status_RD_Analyzer());
		analyzerMap.put(Protocol.BATTERY_RD, new Battery_RD_Analyzer());
		analyzerMap.put(Protocol.CAPACITY_RD, new Capactiy_RD_Analyzer());
		analyzerMap.put(Protocol.CABLE_DATA_RD, new Cable_Data_RD_Analyzer());

		analyzerMap.put(Protocol.GROUND_MUTATION_RD,
				new Ground_mutition_RD_Analyzer());

		analyzerMap.put(Protocol.CURRENT_RD, new Current_RD_Analyzer());
		analyzerMap.put(Protocol.MAGNETIC_RD, new Magnetic_RD_Analyzer());
		// analyzerMap.put(Protocol.RSSI_RD, new RSSI_RD_Analyzer());

		analyzerMap.put(Protocol.ShortFault_RD, new ShortFault_RD_Analyzer());
		analyzerMap.put(Protocol.GroundFault_RD, new GroundFault_RD_Analyzer());
		analyzerMap.put(Protocol.OverHeat_RD, new OverHeat_RD_Analyzer());

		analyzerMap.put(Protocol.CURRENT_PARAMS_RD,
				new Current_Params_RD_Analyzer());
		analyzerMap.put(Protocol.CURRENT_PARAMS_WR, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.TRIVAL_CURRENT_PARAMS_RD,
				new Trival_Current_Params_RD_Analyzer());
		analyzerMap.put(Protocol.TRIVAL_CURRENT_PARAMS_WR,
				new Common_WR_Analyzer());

		analyzerMap.put(Protocol.ZERO_CURRENT_PARAMS_RD,
				new Zero_Current_Params_RD_Analyzer());
		analyzerMap.put(Protocol.ZERO_CURRENT_PARAMS_WR,
				new Common_WR_Analyzer());

		analyzerMap.put(Protocol.LINE_FAULT_RD, new Line_Fault_RD_Analyzer());

		analyzerMap
				.put(Protocol.DEICE_FAULT_RD, new Device_Fault_RD_Analyzer());

		analyzerMap.put(Protocol.GROUND_ELECTRIC_FIELD_RD,
				new Ground_ElectricField_RD_Analyzer());
		analyzerMap.put(Protocol.GROUND_SAMPLE_RD,
				new Ground_Sample_RD_Analyzer());
		analyzerMap.put(Protocol.GROUND_TEMP_CURRENT_RD,
				new Ground_Temp_Current_RD_Analyzer());
		// analyzerMap.put(Protocol.GROUND_TEMP_CURRENT_RD2, new
		// Ground_Temp_Current_RD2_Analyzer());
		analyzerMap.put(Protocol.LAST_GROUND_TIME_RD,
				new Last_Ground_Time_RD_Analyzer());

		analyzerMap.put(Protocol.LAST_SHORT_INFO_RD,
				new LastShortInfo_RD_Analyzer());
		analyzerMap.put(Protocol.LAST_SHORT_CURRENT_RD,
				new LastShortCurrent_RD_Analyzer());
		analyzerMap.put(Protocol.SHORT_ELECTRIC_FIELD_RD,
				new ShortElectricField_RD_Analyzer());
		// analyzerMap.put(Protocol.CHIP_TEMP_RD,
		// new ChipTemperature_RD_Analyzer());
		analyzerMap.put(Protocol.SHORT_FAULT_STATUS_RD,
				new ShortFaultStatus_RD_Analyzer());

		// analyzerMap.put(Protocol.DATA_FRAME_FAULT_COUNT_RD,
		// new DataFrameFaultCount_RD_Analyzer());
		// analyzerMap
		// .put(Protocol.SHORT_SAMPLE_RD, new ShortSample_RD_Analyzer());
		analyzerMap.put(Protocol.START_BITS_RD, new StartBits_RD_Analyzer());
		analyzerMap.put(Protocol.START_BITS_WR, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.AIR_FACTORY_PARAMS_RD,
				new AirFactoryParams_RD_Analyzer());
		analyzerMap.put(Protocol.AIR_FACTORY_PARAMS_WR,
				new Common_WR_Analyzer());

		analyzerMap.put(Protocol.CABLE_FACTORY_PARAMS_RD,
				new CableFactoryParams_RD_Analyzer());
		analyzerMap.put(Protocol.CABLE_FACTORY_PARAMS_WR,
				new Common_WR_Analyzer());

		analyzerMap.put(Protocol.ERASE_DATA, new Common_WR_Analyzer());
		analyzerMap.put(Protocol.ERASE_PARAMS, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.MODULE_MODE_RD, new ModuleMode_RD_Analyzer());
		analyzerMap.put(Protocol.MODULE_MODE_RW, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.STARTUP_PARAMS_RD,
				new Startup_Params_RD_Analyzer());
		analyzerMap.put(Protocol.STARTUP_PARAMS_WR, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.NEIGHBOR_INFO_RD,
				new NEIGHBOR_INFO_RD_Analyzer());
		analyzerMap.put(Protocol.NEIGHBOR_INFO_WR, new Common_WR_Analyzer());
		analyzerMap.put(Protocol.FLIP_ACTION, new Common_WR_Analyzer());
		analyzerMap.put(Protocol.NETWORK_FILE_WR, new Common_WR_Analyzer());
		analyzerMap.put(Protocol.NETWORK_SET, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.RELAY_INFO_RD, new RelayInfo_RD_Analyzer());
		analyzerMap.put(Protocol.RELAY_INFO_WR, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.DATA_FCI_TIME_BEGIN, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_1,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_2,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_3,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_4,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_5,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_6,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_7,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_8,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_9,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_10,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_11,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_12,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_13,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_14,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_15,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_T0DAY_CUR_16,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_1,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_2,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_3,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_4,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_5,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_6,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_7,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_8,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_9,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_10,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_11,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_12,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_13,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_14,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_15,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_1_DAY_CUR_16,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_1,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_2,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_3,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_4,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_5,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_6,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_7,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_8,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_9,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_10,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_11,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_12,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_13,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_14,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_15,
				new Load_Current_Analyzer());
		analyzerMap.put(Protocol.DATA_MINUX_2_DAY_CUR_16,
				new Load_Current_Analyzer());

		analyzerMap.put(Protocol.T_Version_RD, new Terminal_Version_Analyzer());
		analyzerMap.put(Protocol.REG_STATUS_RD, new REG_STATUS_RD_Analyzer());
		analyzerMap.put(Protocol.T_AREA_CODE_RD, new AreaCode_RD_Analyzer());
		analyzerMap.put(Protocol.T_AREA_CODE_WR, new Common_WR_Analyzer());

		analyzerMap.put(Protocol.T_COMMUNICATIONS_RD,
				new Terminal_Comm_RD_Analyzer());
		analyzerMap.put(Protocol.T_COMMUNICATIONS_WR, new Common_WR_Analyzer());
		analyzerMap.put(Protocol.TERMINAL_RESET, new Terminal_Reset_Analyzer());
	}

	public AnalyzerIF getAnalyzer(String cmdId) {
		return analyzerMap.get(cmdId);
	}
}
